mixin flip-card(cover, card)
  -var {url: cardCoverUrl, width, height} = images[cover]
  -var cardUrl = images[card].url
  svg(version=`1.1`, viewBox=`0 0 ${width} ${height}`, x=`0px`, y=`0px`)
    // g
      a(href=`https://support.weixin.qq.com/cgi-bin/mmsupport-bin/showredpacket?receiveuri=kXsuSFNVQzB&check_type=2#wechat_redirect`, data-linktype=`2`)
        foreignObject(width=`100%`, height=`100%`, x=`0`, y=`0`)
          svg(style=`pointer-events:visible`, version=`1.1`, viewBox=`0 0 ${width} ${height}`, x=`0px`, y=`0px`)
    g
      animateTransform(attributeName=`transform`, type=`translate`, values=`${width/2} ${height/2}`, dur=`0.8s`, repeatCount=`indefinite`, restart=`whenNotActive`, begin=`click`, additive=`sum`)
      animateTransform(attributeName=`transform`, type=`scale`, values=`1 1;-1 1;-1 1`, dur=`8000s`, keyTimes=`0;0.0001;1`, restart=`whenNotActive`, fill=`freeze`, additive=`sum`, begin=`click`)
      animateTransform(attributeName=`transform`, type=`translate`, values=`-${width/2} -${height/2}`, dur=`0.8s`, repeatCount=`indefinite`, restart=`whenNotActive`, begin=`click`, additive=`sum`)
      foreignObject(width=`100%`, height=`100%`, x=`0`, y=`0`, transform=`matrix(-1 0 0 1 ${width} 0)`)
        svg(style=`background-image:url("${cardUrl}");background-position:0 0;background-repeat:no-repeat;background-size:cover;pointer-events:none`, version=`1.1`, viewBox=`0 0 ${width} ${height}`, x=`0px`, y=`0px`)
      g
        foreignObject(width=`100%`, height=`100%`, x=`0`, y=`0`)
          svg(style=`background-image:url("${cardCoverUrl}");background-position:0 0;background-repeat:no-repeat;background-size:cover;pointer-events:painted`, version=`1.1`, viewBox=`0 0 ${width} ${height}`, x=`0px`, y=`0px`)
            animate(attributeName=`height`, begin=`click+0.4s`, restart=`never`, dur=`0.00001s`, to=`0`, fill=`freeze`, calcMode=`discrete`)
